import React, { Component } from 'react';
import { NavigationActions, StackActions, NavigationEvents } from 'react-navigation'
import { GLOBAL } from '../../../config/global';
import { StyleSheet, KeyboardAvoidingView, Platform, Text, View, Image, Alert, FlatList, TouchableOpacity, PixelRatio, TextInput, ScrollView, ImageBackground } from "react-native";
import { style } from '../../../theme/style';
import { Common } from '../../../component/common/Common';
import { OrderCommon } from '../_common/common';
import { BockCpt } from '../details/_components/BockCpt';
import { LieCpt } from '../details/_components/LieCpt';
import { GoodsItemCpt } from './_components/GoodsItemCpt';
import { BigQuantityCpt } from './_components/BigQuantityCpt';
import { QuantityAdressCpt } from './_components/QuantityAdressCpt';
import { PageStatusIndex } from '../../../component/page-status/PageStatusIndex';
import serviceAPI from './_common/serviceAPI';
import MethodUtil from '../../../utils/MethodUtil';
import moment from 'moment';
import { CommonDialog } from '../../../components/common/Dialog';
import ToastUtil from '../../../utils/toast';
import StorageHelper from '../../../utils/storageHelper';
import { STORAGE_CONSTANT } from '../../../config/storage';



const scale = GLOBAL.SCALE;

/** 
 * titleName: '' // 顶部标题名
 * isQh: true/false // 是否是泉化
 * longFrame: {}  // 再次选择，把之前数据的传过来
 * */

/*
* isCustIntentionPlan :   //是否客户填报意向计划【Y.是 N.否】 是否是拆量
* tranReportType :  //待转成交报告类型【N.现货销售 Q.泉化销售】
*/

export class TurnOrderInfo extends Component {
  static navigationOptions = ({ navigation, navigationOptions }) => {
    let { orderType } = navigation.state.params || {};
    console.log('navigation.state.params-9999999999', navigation.state.params)
    return {
      title: `${orderType == 'P' ? '采购' : '销售'}转单管理`,
      headerTintColor: style.color.white,
      headerLeft: <Common type="headLeft" onPress={() => { navigation.goBack() }} color='#fff' />,
      headerRight: <Image style={style.head.headRightEmpty} source={require('../../../imgs/goBackEmpty.png')} />,
      headerStyle: {
        elevation: 0,
        backgroundColor: style.color.themeColor,
        borderBottomWidth: 0
      },
      headerTitleStyle: {
        flex: 1,
        textAlign: 'center'
      }
    }
  }

  constructor(props) {
    super(props);
    this.paramsData = props.navigation.state.params || {};
    this.state = {
      status: 'loading',
      data: null,
      tabIndex: 0,
      toolData: {},
      orderData: null,
      isLoadIco: false,  // 下拉涮新的 图标
      modalVisible: false
    };
    this.paramsData.pageNo = 1;
    this.totalPage = 0;
    this.listShowArr = []; // 展示用
    this.listSendArr = []; //参数用
    this.lsObj = {};
    this.listAddressArr = null;
    this.addressIndex = 0;
    this.srcAddressId = null; // 选中地址id
    this.srcAddress = null; // 选中地址名字
    this.mergeShowData = []; // 合并后转单
    this.bidOrderIds = []; // 控制后面商品  传递给创建订单页面
    this.listSendQhArr = []; // 多计划量传递到创建成交报告页面
  }

  async componentWillMount() {
    this._getUserId();
    this._initPage();
  }

  _initPage = async () => {
    let { tabIndex } = this.state;
    this.setState({
      isLoadIco: true
    })
    if (!tabIndex) { // tab1
      let responeData = await serviceAPI.getDetails(this.paramsData);
      console.log('产品信息数据', responeData)
      //特殊
      if (responeData) {
        // 新增勾选字段
        responeData.resourceBidOrderList && responeData.resourceBidOrderList.map((item) => {
          item.bigChecked = false;
        })
        this.companyId = responeData.companyId;
        //地址数据赋值
        this.listAddressArr = responeData.srcAddressList || null;
        //默认第一条数据选中
        if (this.listAddressArr && this.listAddressArr.length) {
          this.srcAddressId = this.listAddressArr[0].addressId;
          this.srcAddress = this.listAddressArr[0].addressName;
        }
        this.setState({ data: responeData, status: 'data', isLoadIco: false })
        if (responeData.isCustIntentionPlan == 'N') {
          this._getListShowArr(responeData.resourceBidOrderList);
        }
      } else {
        this.setState({ status: 'empty', data: null, isLoadIco: false })
      }
    } else {
      let toolData = await serviceAPI.getPool(this.paramsData);
      let responeOrderList = await serviceAPI.getOrderList(this.paramsData);
      if (toolData) {
        this.setState({
          orderData: responeOrderList.rows,
          toolData,
          status: 'data',
          isLoadIco: false
        })
      } else {
        this.setState({
          status: 'empty',
          data: null,
          isLoadIco: false
        })
      }
    }
  }

  _tabFn = (tabIndex) => {
    this.setState({
      tabIndex
    }, () => {
      this._initPage();
    })
  }

  // 基本信息模版
  _viewBase = (sendData, index) => {
    return (
      <LieCpt data={sendData} key={index} />
    )
  }

  //非拆量订单 展示数据获取
  _getListShowArr = (arrData) => {
    console.log('非拆量订单 展示数据获取', arrData);
    this.listShowArr = arrData;
  }

  //合并交验
  _isMergeFn = (itemData, checkedGoods) => {
    console.log('0000', itemData);
    let result = false;
    if (itemData.isCustIntentionPlan != "Y") { // 拆量
      if (this._isGoodsFn(checkedGoods)) {
        console.log('过不去')
        result = true;
      }
    }
    return result;
  }
  //id一致、单价不一致：不支持合并转单，异常提示   X1及X2为同商品不同单价，无法支持合并转单
  _isGoodsFn = (paramsData) => {
    let result = false;
    let goodsArr = {};
    if (paramsData && paramsData.length > 1) {
      paramsData.forEach((item, index) => {
        if (goodsArr[item.goodsId]) {
          goodsArr[item.goodsId].push(item)
        } else {
          goodsArr[item.goodsId] = [item];
        }
      })
      for (var i in goodsArr) {
        if (goodsArr[i].length > 1) {
          goodsArr[i].forEach(item => { // 验证价格是不是一致
            if (item.price != goodsArr[i][0].price) {
              ToastUtil.showWarning(`${goodsArr[i][0].goodsName}和${goodsArr[i][1].goodsName}为同商品不同单价，无法支持合并转单`);
              result = true;
            }
          })
        }
      }

    }
    return result;
  }

  //获取选中的商品
  _getSelectGoods = () => {
    let { data } = this.state || {};
    let { resourceBidOrderList } = data || {};
    let checkedArr = []; // 选中的商品
    resourceBidOrderList && resourceBidOrderList.forEach((items, index) => {
      if (items.bigChecked) {
        checkedArr.push(items);
      }
    })
    console.log('获取选择的商品数据', checkedArr)
    return checkedArr;
  }


  //获取参数
  _getMergeParams = () => {
    let checkedArr = this._getSelectGoods();
    console.log('this._getSelectGoods()', this._getSelectGoods())
    let bidOrderGroupIdList = [];
    let bidOrderGroupItemIdList = [];
    let planList = [];
    this.listSendQhArr = []; // 清空上一次的
    checkedArr && checkedArr.forEach((item) => {
      bidOrderGroupIdList.push(item.bidOrderGroupId);
      bidOrderGroupItemIdList.push(item.bidOrderGroupItemId);

      // 多计划特殊处理 量
      if (item.bidIntentionOrderList) {
        let lsObj = {};
        lsObj.bidOrderId = item.bidOrderId;
        lsObj.quantity = [];
        item.bidIntentionOrderList.forEach(items => {
          if (items.checked) {
            lsObj.quantity.push(items.quantity);
            this.listSendQhArr.push(items);
          }
        })
        planList.push(lsObj);
      }
    })
    return { companyId: this.companyId, bidOrderGroupIdList, bidOrderGroupItemIdList, planQuantityList: planList || null }
  }

  //创建按钮
  _goOrderPage = async (itemData) => {
    this.bidOrderIds = [];//清空
    let goodsId = null;
    let bidOrderId = null;
    let { isCustIntentionPlan } = itemData || {};
    let checkedGoods = this._getSelectGoods();

    if (checkedGoods && checkedGoods.length < 1) {
      ToastUtil.showWarning(`请选勾选商品`);
      return
    }
    //合并控制
    if (this._isMergeFn(itemData, checkedGoods)) return;
    let responeData = await serviceAPI.goodsMerge(this._getMergeParams());
    if (!responeData) return;
    this.mergeShowData = responeData;

    //拆量
    if (isCustIntentionPlan == 'Y') { // 
      let onoff = false;
      checkedGoods && checkedGoods.forEach((item) => {  // 判断子项有没有勾选
        if (item.bigChecked) {
          goodsId = item.goodsId;
          bidOrderId = item.bidOrderId;
          item && item.bidIntentionOrderList.forEach((items) => {
            if (items.checked) {
              onoff = true;
            }
          })
        }
      })
      if (!onoff) {
        ToastUtil.showWarning('请先勾选商品');
      } else {
        this.setState({
          modalVisible: true,
          lsGoodsId: goodsId,  // 临时存储
          lsBidOrderId: bidOrderId, // 临时存储
          lsitemData: itemData // 临时存储
        })
      }

    } else {
      console.log('非拆量')
      this.setState({
        modalVisible: true,
        lsGoodsId: goodsId,  // 临时存储
        lsBidOrderId: bidOrderId, // 临时存储
        lsitemData: itemData // 临时存储
      })
    }
  }

  // 泉化 根据lsQhBidOrderId 过滤
  _qhFilter = (arrData, lsbidOrderId) => {
    let lsArr = [];
    arrData && arrData.forEach((item) => {
      if (lsbidOrderId == item.bidOrderId) {
        lsArr.push(item);
      }
    })
    return lsArr;
  }

  //跳页面
  _goPage = async () => {
    let { lsBidOrderId, lsitemData } = this.state;
    let { bidId, companyId, payType, payStyle,
      payExpireDays,
      deliveryExpireDays,
      deliveryType,
      transportType,
      isCustIntentionPlan } = lsitemData || {};
    let { orderType } = this.paramsData || {};
    let lsGoodsId = null;

    //
    let responeData = await serviceAPI.goodsMergeSubmit(this._getMergeParams());
    this.bidOrderIds = responeData || [];

    //修改失败
    if (!responeData) return;

    this.setState({
      modalVisible: false
    })

    if (this.paramsData.tranReportType == 'Q') {
      lsGoodsId = this.mergeShowData[0] && this.mergeShowData[0].goodsId || null;
      this.props.navigation.navigate('LongFrameListPage', {
        isQh: true,
        orderType: 'S',
        periodType: 'L',  // 
        tCode: 'QH',
        titleName: '泉化销售',
        bidId,
        companyId,
        goodsId: lsGoodsId,
        bidOrderId: lsBidOrderId,
        tranReportType: this.paramsData.tranReportType,
        isCustIntentionPlan: isCustIntentionPlan,
        bidIntentionOrderList: this.listSendQhArr,
        bidOrderItemList: this.listShowQhArr,
        srcAddress: this.srcAddress,
        srcAddressId: this.srcAddressId,
        bidOrderIds: this.bidOrderIds,
        sendData: {
          companyId,
          payType,
          payStyle,
          payExpireDays,
          deliveryExpireDays,
          deliveryType,
          transportType,
          goodsId: lsGoodsId,
          srcAddress: this.srcAddress,
          srcAddressId: this.srcAddressId,
          priceFormlaId: this.mergeShowData[0].priceFormlaId || null
        }
      })
    } else {
      this.props.navigation.navigate('orderBaseTurnPage', {
        isCustIntentionPlan: isCustIntentionPlan,
        bidIntentionOrderList: this.listSendQhArr,
        bidOrderItemList: this.listShowArr,
        bidId,
        tranReportType: this.paramsData.tranReportType,
        srcAddressId: this.srcAddressId,
        srcAddress: this.srcAddress,
        orderType,
        bidOrderIds: this.bidOrderIds
      })
    }
  }

  //拆量转单 数据整合
  _QuantityCallBack = (data) => {
    console.log('数据', data)
    this.listSendArr = [];//清空
    this.listShowArr = [];//清空
    let lsArr = [];
    let stringObj = {};
    stringObj = JSON.parse(JSON.stringify(data));
    stringObj && stringObj.forEach((item, index) => {
      this.lsObj[item.intentionOrderId] = item;
    });
    console.log('this.lsObj-123', this.lsObj)
    // 原始数据
    for (value in this.lsObj) {
      if (this.lsObj[value].checked) {
        lsArr.push(this.lsObj[value])
      }
    }
    this.listSendArr = lsArr; // 勾选的存起来
    console.log('this.listSendArr', this.listSendArr)

    let lsObj = {}; // 判断相同的 把量累加起来
    //整合数据
    lsArr && lsArr.forEach(item => {
      if (lsObj[item.bidOrderId]) {
        lsObj[item.bidOrderId].quantity = parseInt(lsObj[item.bidOrderId].quantity) + parseInt(item.quantity);
      } else {
        let sdd = null;
        sdd = JSON.parse(JSON.stringify(item));
        lsObj[item.bidOrderId] = sdd;
      }
    });
    console.log('1111-lsObj', lsObj)

    //最终展示数据
    let endArr = [];
    for (value in lsObj) {
      if (lsObj[value].checked) {
        endArr.push(lsObj[value])
      }
    }
    this.listShowArr = endArr;
  }

  // 退回认领控制弹框
  _isAlert = (data) => {
    // 通过 批量通过 批量驳回
    Alert.alert('提示', `是否退回认领？`, [
      {
        text: '确认', onPress: () => {
          this._cancelFn(data);
        }
      },
      {
        text: '取消', onPress: () => { console.log('通过-取消') }
      },
    ]);
  }

  // 退回认领
  _cancelFn = async (data) => {
    if (!data) return;
    let sendData = [];
    data.resourceBidOrderList && data.resourceBidOrderList.forEach((item) => {
      sendData.push(item.bidOrderId)
    })
    let responeData = await serviceAPI.cancel({ bidOrderIdList: sendData });
    if (responeData) {
      ToastUtil.showSuccess('资源意向认领撤销操作成功').then(() => {
        resetAction = StackActions.reset({
          index: 1,
          actions: [
            NavigationActions.navigate({ routeName: 'HomePage' }),//要跳转到的页面名字
            NavigationActions.navigate({ routeName: 'ToClaimList' })//要跳转到的页面名字
          ]
        });
        this.props.navigation.dispatch(resetAction);
      })
    } else {
      ToastUtil.showWarning('资源意向认领撤销操作失败');
    }

  }

  // 获取用户id
  _getUserId = async () => {
    let userInfo = await StorageHelper.get(STORAGE_CONSTANT.USER_INFO_KEY);
    if (userInfo) {
      userInfo = JSON.parse(userInfo);
      this.userId = userInfo.userId;
    }
    console.log('this.userId', this.userId)
  }

  // 产品信息
  _renderInfoView = (itemData) => {
    let { orderType } = this.paramsData || {};
    console.log('基本信息-000000', itemData, orderType, this.paramsData.choice);
    itemData.bizTeamNameList && itemData.bizTeamNameList.toString();
    let infoBase = [
      { lable: '资源包名称', value: [[itemData.bidPackageName || '-']] },
      { lable: '资源包ID', value: [[itemData.bidPackageId || '-']] },
      { lable: `${orderType == 'P' ? '收款' : '付款'}类型`, value: [[itemData.payTypeName || '-']] },
      { lable: `${orderType == 'P' ? '收款' : '付款'}方式`, value: [[itemData.payStyleName || '-']] },
      { lable: '交付方式', value: [[itemData.deliveryTypeName || '-']] },
      { lable: '运输方式', value: [[itemData.transportTypeName || '-']] },
      { lable: '出库地', value: [[itemData.srcAddress || '-']] },
      { lable: '目的地', value: [[itemData.destAddress || '-']] },
      { lable: '提货期限', value: [[itemData.deliveryBeginDate && moment(itemData.deliveryBeginDate).format("YYYY-MM-DD") || '-']] },
      {
        lable: '业务员(部门)', value: [[itemData.bizStaffName || itemData.bizTeamNameList || itemData.organName ? `${itemData.bizStaffName} | ${itemData.bizTeamNameList || '--'} | ${itemData.organName}` : '--']]
      },
      { lable: '业务组织', value: [[this.paramsData.choice ? this.paramsData.choice.corpName : '-']] }
    ]

    return (
      <ScrollView style={styles.infoBoxScroll} showsVerticalScrollIndicator={false} keyboardShouldPersistTaps={'handled'}>
        <View style={[styles.infoBox, { justifyContent: 'space-between' }]}>
          <View style={styles.infoItem}>
            <Text style={styles.infoQy}>{itemData.companyName}</Text>
          </View>
          <View style={styles.infoImg}>
            <Text style={styles.statusText}>{itemData.reportStatusName}</Text>
            {/* <Text style={styles.statusText}>
              {items.reportStatus == '7' ? '全部待转' : (items.reportStatus == '6' ? '部分待转' : '已转订单')}
            </Text> */}
          </View>
        </View>
        <View style={{ flexDirection: 'row' }}>
          {/* 敞 */}
          {this.paramsData.tranReportType == 'N' ? <Image source={require('../../../imgs/warning/openOrder.png')} style={styles.infoItemBigImg} /> : null}
          {/* 泉 */}
          {this.paramsData.tranReportType == 'Q' ? <Image source={require('../../../imgs/warning/qhOrder.png')} style={styles.infoItemBigImg} /> : null}
        </View>
        <BockCpt data={{
          title: '交易信息',
          listData: infoBase,
        }} renderView={this._viewBase} />
        <View style={styles.flexRow}>
          {
            (this.userId == itemData.bizStaffId && itemData.reportStatus == '5') ? <View style={styles.creatBox}>
              <Text style={styles.creatBtn} onPress={() => { this._isAlert(itemData) }}>退回认领</Text>
            </View> : null
          }
          {
            this.userId == itemData.bizStaffId && itemData.reportStatus != '7' ? <View style={styles.creatBox}>
              <Text style={styles.creatBtn} onPress={() => { this._goOrderPage(itemData) }}>创建订单</Text>
            </View> : <View style={{ height: 20 * scale }}></View>
          }
        </View>
        {/* 5 代转  6 部分转  7 全部 */}

        <BigQuantityCpt key={new Date().getTime()} checkedCallBack={this._checkedCallBack} quantityCallBack={this._QuantityCallBack} data={{ data: itemData, paramsData: this.paramsData }} />

      </ScrollView>
    )
  }

  //
  _renderItemView = (customer) => {
    let itemData = customer.item;
    return <GoodsItemCpt itemData={itemData} navigation={this.props.navigation} />
  }

  // 成交记录
  _renderHistoryView = () => {
    let { toolData, orderData, isLoadIco } = this.state || {};
    return (<View style={{ flex: 1 }}>
      <ImageBackground source={require('../../../imgs/turn/turn-his.png')} style={styles.hisHeadBox}>
        <Text style={styles.hisHeadText}>客户成交总量：{MethodUtil.toThousands(toolData.bidQuantity, 2) || '-'}吨</Text>
        <Text style={styles.hisHeadText}>已转订单：{MethodUtil.toThousands(toolData.orderQuantity, 2) || '-'}吨，总成交价： ¥{MethodUtil.countObj.divide(toolData.orderAmount, 10000) || '0'}万元</Text>
        <Text style={styles.hisHeadText}>剩余待转：{MethodUtil.toThousands(toolData.remainQuantity, 2) || '-'}吨</Text>
      </ImageBackground>
      <View style={styles.ScrollViewStyle}>
        <FlatList
          data={orderData}
          extraData={this.state}
          renderItem={this._renderItemView}
          refreshing={isLoadIco}
          onRefresh={this._isLoadRefresh}
          onEndReachedThreshold={0.5}
          onEndReached={this._onEndReached}
        />
      </View>
    </View>)
  }


  // 下拉更新函数
  _isLoadRefresh = async () => {
    this.paramsData.pageNo = 1;
    await this._initPage(true);
  }

  // 上拉更新函数
  _onEndReached = async () => {
    if (this.paramsData.pageNo < this.totalPage) {
      this.paramsData.pageNo++;
      this._initPage();
    }
  }

  _callBackAdress = (index) => {
    this.addressIndex = index;
    this.srcAddressId = this.listAddressArr[index].addressId;
    this.srcAddress = this.listAddressArr[index].addressName;
  }

  // 弹框dome
  _renderCustom = () => {
    console.log('this.mergeShowData--弹框数据', this.mergeShowData)
    if (!this.mergeShowData.length) {
      return null;
    }
    return (
      <View style={styles.tipBox}>
        <Text style={styles.tipBoxOrderTitle}>本次壹化网转单商品：</Text>
        <Text style={[styles.tipBoxOrderTitle, styles.tipColorRed]}>合计：{this.mergeShowData[0].totalQuantity || '-'}吨，{MethodUtil.toThousands(this.mergeShowData[0].totalAmt, 3) || '-'}元</Text>
        <View style={styles.scroll}>
          {
            this.mergeShowData && this.mergeShowData.length && this.mergeShowData.map((item, index) => {
              return (<View style={styles.tipComputerItem} key={index}>
                <View style={[styles.tipComputerItemUp, styles.infoBox]}>
                  <Text style={[styles.fontSize13, styles.fontbold, styles.fix5]}>{item.goodsName}</Text>
                  <Text style={[styles.fontSize13, styles.fontbold, styles.fix3]}>¥ {item.price || '-'}/吨</Text>
                  <Text style={[styles.fontSize13, styles.fontbold, styles.fix2, styles.textRight]}>{item.quantity || '-'}吨</Text>
                </View>
                {
                  item.ubmpResourceBidOrderTOList.map((items, indexs) => {
                    return <Text key={indexs} style={[styles.fontSize11, styles.textRight]}>{`${items.goodsName} ¥ ${items.price || '-'}/吨    ${items.quantity || '-'}吨`}</Text>
                  })
                }
              </View>)
            })
          }
        </View>
        {
          this.listAddressArr &&
          <View>
            <Text style={[styles.tipBoxOrderTitle, styles.tipAddressTitle]}>出库地址:</Text>
            <QuantityAdressCpt callBackAdress={this._callBackAdress} addressIndex={this.addressIndex} data={this.listAddressArr} />
          </View>
        }
      </View>
    )
  }

  _checkedCallBack = (callBack) => {
    console.log('callBack-123', callBack)
  }

  render() {
    let { status, tabIndex, data, modalVisible } = this.state || {};
    console.log('data-数据', data, status)
    return (
      <View style={styles.container}>
        <NavigationEvents
          onWillFocus={() => {
            this._getUserId();
            this._initPage();
          }}
        />
        <KeyboardAvoidingView style={styles.container} behavior={Platform.OS === 'ios' ? 'padding' : null} keyboardVerticalOffset={65 * scale} >
          {
            status == 'data' && data ? (<View style={{ flex: 1 }}>
              <View style={styles.headBox}>
                <View style={styles.tabBox}>
                  <TouchableOpacity activeOpacity={1} onPress={() => { this._tabFn(0) }} style={[tabIndex == 0 ? styles.tabPreActive : styles.tabPre]}>
                    <Text style={[styles.tabText, tabIndex == 0 ? styles.tabTextActive : null]}>产品信息</Text>
                  </TouchableOpacity>
                  <TouchableOpacity activeOpacity={1} onPress={() => { this._tabFn(1) }} style={[tabIndex == 1 ? styles.tabPreActive : styles.tabPre]}>
                    <Text style={[styles.tabText, tabIndex == 1 ? styles.tabTextActive : null]}>成交记录</Text>
                  </TouchableOpacity>
                </View>
              </View>
              <View style={styles.body}>
                {tabIndex == 1 ? this._renderHistoryView(data) : this._renderInfoView(data)}
              </View>
            </View>) : (<View style={{ position: 'absolute', height: '100%', width: '100%', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
              <PageStatusIndex status={status} />
            </View>)
          }
          {
            modalVisible ? <CommonDialog
              modalVisible={modalVisible}
              title={'提示'}
              confirmBtnText={'确认转单'}
              renderCustom={this._renderCustom}
              onConfirmPress={this._goPage}
              onClosePress={() => { this.setState({ modalVisible: false }) }}
              moreText={'*当壹化网转单存在多物料对应掌上化销同一商品，且单价一致时，系统自动合并转单数量，泉化订单类型仅支持一单一商品'}
            /> : null
          }
        </KeyboardAvoidingView>
      </View>

    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F5F5F5',
    position: 'relative'
  },
  headBox: {
    height: 65 * scale,
    backgroundColor: style.color.themeColor,
  },
  searchWrap: {
    width: '100%',
    height: 66 * scale,
    flexDirection: 'row',
    justifyContent: 'space-around',
    alignItems: 'center',
  },
  btnWarp: {
    height: 72 * scale,
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-around',
  },
  tabBox: {
    flexDirection: 'row',
    justifyContent: 'space-around',
    alignItems: 'center',
    marginTop: 20 * scale
  },
  tabPre: {
    borderBottomWidth: 2 * scale,
    borderStyle: 'solid',
    borderBottomColor: style.color.themeColor,
  },
  tabText: {
    fontSize: 14 * scale,
    color: '#fff',
    padding: 10 * scale,
    opacity: .8,
  },
  tabTextActive: {
    opacity: 1,
  },
  tabPreActive: {
    borderBottomWidth: 2 * scale,
    borderStyle: 'solid',
    borderBottomColor: style.color.white,
  },
  body: {
    flex: 1,
  },
  infoBoxScroll: {
    paddingLeft: 15 * scale,
    paddingRight: 15 * scale
  },
  infoItem: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    paddingTop: 20 * scale,
    paddingBottom: 15 * scale
  },
  infoQy: {
    fontSize: 16 * scale,
    color: '#333',
    fontWeight: 'bold'
  },
  infoState: {
    fontSize: 13 * scale,
    color: style.color.lightRed
  },
  infoImg: {
    flexDirection: 'row',
    alignItems: 'center',
    marginBottom: 10 * scale,
    marginLeft: 5 * scale,
    marginTop: 13 * scale
  },
  infoItemImg: {
    width: 18 * scale,
    height: 18 * scale,
    marginRight: 6 * scale
  },
  creatBtn: {
    width: 85 * scale,
    height: 30 * scale,
    backgroundColor: style.color.themeColor,
    color: '#fff',
    lineHeight: 30 * scale,
    textAlign: 'center',
    borderRadius: 8 * scale,
    overflow: 'hidden',
    fontSize: 13 * scale
  },
  quantity: {
    width: 120 * scale,
    paddingLeft: 25 * scale,
  },
  creatBox: {
    flexDirection: 'row',
    justifyContent: 'flex-end',
    marginTop: 15 * scale,
    marginBottom: 15 * scale,
    marginLeft: 15 * scale
  },
  hisHeadBox: {
    width: 345 * scale,
    height: 62 * scale,
    marginLeft: 15 * scale,
    marginTop: 15 * scale,
    paddingLeft: 25 * scale,
    paddingTop: 5 * scale
  },
  hisHeadText: {
    fontSize: 12 * scale,
    color: '#0E5BC6',
    lineHeight: 18 * scale
  },
  ScrollViewStyle: {
    flex: 1,
    //flexDirection: 'column',
    marginTop: 20 * scale
  },
  infoBox: {
    flexDirection: 'row',
    alignItems: 'center'
  },
  bold: {
    fontWeight: 'bold'
  },
  tipBox: {
    paddingLeft: 10 * scale,
    paddingRight: 10 * scale,
  },
  tipBoxOrderTitle: {
    fontSize: 13 * scale,
    fontWeight: 'bold',
    color: '#333',
    marginBottom: 15 * scale
  },
  tipColorRed: {
    color: '#E02020',
    fontWeight: 'normal',
    marginTop: -10 * scale
  },
  tipBoxOrderList: {
    flexDirection: 'row',
    marginBottom: 10 * scale,
  },
  tipBoxOrderText: {
    fontSize: 13 * scale,
    marginRight: 5 * scale
  },
  tipBoxOrderTextTitle: {
    width: 60 * scale
  },
  tipAddressTitle: {
    marginTop: 25 * scale
  },
  flexRow: {
    flexDirection: 'row',
    justifyContent: 'flex-end'
  },

  infoItemBigImg: {
    width: 23 * scale,
    height: 23 * scale,
    marginRight: 10 * scale
  },
  statusText: {
    fontSize: 13 * scale,
    fontWeight: 'bold',
    color: '#F11111'
  },
  fontSize13: {
    fontSize: 13 * scale,
  },
  fontSize11: {
    fontSize: 11 * scale,
    opacity: .6
  },
  fontbold: {
    fontWeight: 'bold'
  },
  fix5: {
    flex: 5
  },
  fix2: {
    flex: 2
  },
  fix3: {
    flex: 3
  },
  textRight: {
    textAlign: 'right'
  },
  tipComputerItemUp: {
    marginBottom: 5 * scale
  },
  scroll: {
    marginTop: 10 * scale
  },
  tipComputerItem: {
    marginBottom: 10 * scale
  }
})